package org.example.chatroom.demos.controller;

import org.example.chatroom.demos.model.User;
import org.example.chatroom.demos.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RequestMapping("/user")
@RestController
public class UserController {

    @Autowired
    private UserService userService ;

     // 登录
    @RequestMapping("/login" )
    public Object login(User user , HttpSession httpSession ){

        return userService.longin(user , httpSession) ;

    }


//    获取当前用户信息
    @RequestMapping("/getUserInfo")
    public Object getUserInfo(HttpSession session){
        return userService.getUserInfo(session) ;
    }

//    获取好友列表


//    注册
    @RequestMapping("/register")
    public Object register(User user){
        return userService.insertUser(user);
    }

}
